<template>
  <div class="dialog" v-if="flag" :style="{ width, height }">
    <h3>{{ title }}</h3>
    <main>
      <slot></slot>
    </main>
  </div>
</template>
<script>
export default {
  props: {
    flag: Boolean,
    width: {
      type: String,
      default: '50%'
    },
    height: {
      type: String,
      default: '50%'
    },
    title: String,
  },
  name: '',
  data () {
    return {
    }
  },
  // beforeCreate () {
  //   console.log('beforeCreate===儿子')

  // },
  // created () {
  //   console.log('created===儿子')
  // },
  // beforeMount () {
  //   console.log('beforeMount===儿子')
  // },
  // mounted () {
  //   console.log('mounted===儿子')

  // },
  computed: {
  },
  methods: {
    cancel () {
      this.$emit('update:flag', false);
    }
  }
}
</script>
<style lang='less'  scoped>
.dialog {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  // width: 100vw;
  // height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px;
  color: aliceblue;
 
  main {
    flex: 1;
  }
}
</style>
